<?php include template("header"); ?>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000">
  <tr>
    <td width="200" align="center" valign="top">

	<table width="167" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="25"><img src="img/left_top.jpg" width="167" height="25" /></td>
      </tr>
      <tr>
        <td align="center" background="img/left_mid.jpg">

			<?php foreach($list as $array){ ?>
			<table width="109" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td height="90" align="center" valign="middle">
				 <table border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
					<tr>
					  <td bgcolor="#3E3E3E"><a href="photo.php?page=<?php echo $page;?>&pageSize=<?php echo $pageSize;?>&id=<?php echo $array['id'];?>&order=<?php echo $order;?>&author=<?php echo urlencode($_GET['author']);?>&title=<?php echo urlencode($_GET['title']);?>"><img src="<?php echo $array['thumburl'];?>"  border=0/></a></td>
					</tr>
				  </table>
				</td>
			  </tr>
			</table>
			<?php } ?>

          <br />
          <table width="150" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="40" align="right"><a href="
			  <?php
				if($page==1){
					echo "javascript:alert('已经是第一页！');";
				}else{
					echo "photo.php?page=".($page-1)."&order=".$order;
				}
			  ?>"><img src="img/left_but_l.jpg" width="28" height="28" border="0" /></a></td>
              <td align="center"><strong><span class="STYLE2"><?php echo $page;?></span>/<?php echo $pagenum;?>页</strong></td>
              <td width="40" align="left"><a href="
			  <?php
				if($page==$pagenum){
					echo "javascript:alert('已经是最后一页！');";
				}else{
					echo "photo.php?page=".($page+1)."&order=".$order;
				}
			  ?>"><img src="img/left_but_r.jpg" width="28" height="28" border="0" /></a></td>
            </tr>
          </table>
          <table width="150" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50" align="center" valign="middle">
			  <select name="select" id="select" onChange="document.location.href='photo.php?order='+this.value">
                <option value="votenum" <?php if($order=='votenum'){echo "selected";} ?>>按人气排序</option>
                <option value="createtime" <?php if($order=='createtime'){echo "selected";} ?>>按发布时间</option>
              </select>
              </td>
            </tr>
          </table>

		  
		  </td>
      </tr>
      <tr>
        <td height="32"><img src="img/left_foot.jpg" width="167" height="32" /></td>
      </tr>
    </table>
      <table width="96%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
        <tr>
          <td align="center"><a href="post.php?small=true&keepThis=true&TB_iframe=true&height=450&width=600" title="上传作品" class="thickbox"><img src="img/upload.jpg" width="157" height="56" border=0/></a></td>
        </tr>
      </table></td>
    <td align="center" valign="top">
	  <table width="96%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50" align="center" valign="middle" style="color:#fff;font-size:14px">
			  <form action="photo.php" method="GET">
				作品搜索：
				&nbsp;&nbsp;作者：<input type="text" name="author" id="author" value="<?php echo $_GET['author'];?>"/>
				&nbsp;&nbsp;标题：<input type="text" name="title" id="title" value="<?php echo $_GET['title'];?>"/>
				&nbsp;&nbsp;<input type="submit" value="提 交" class="Btn BtnNml" style="height:22px">
			  </form>
              </td>
            </tr>
          </table>
      <table border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
        <tr>
          <td bgcolor="#3E3E3E"><a href="<?php echo $nextHref;?>"><img src="<?php echo $photo['imageurl'];?>" id="photo" width="<?php echo $photoWidth;?>" height="<?php echo $photoHeight;?>" border=0/></a></td>
        </tr>
      </table>
      <br />
      <table width="750" border="0" cellspacing="0" cellpadding="0"  bgcolor="#000000">
        <tr>
          <td width="615" height="42" align="center" valign="middle" background="img/photo_detil.jpg"><table width="600" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="350" align="left"><strong>参赛作品：<?php echo $photo['title'];?></strong></td>
              <td width="120" align="left"><strong>作者：<?php echo $photo['author'];?></strong></td>
              <td height="30" align="left"><span class="STYLE4">获得票数：<span id="votenum"><?php echo $photo['votenum'];?></span>票</span></td>
            </tr>
          </table></td>
          <td align="center"><a href="javascript:vote(<?php echo $id;?>)"><img src="img/photo_vote.jpg" width="120" height="41" border="0" /></a></td>
        </tr>
      </table>
      <table width="150" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table>
      <table width="96%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="30" align="left" valign="middle" bgcolor="#6E6E6E"><strong>　作品简介：</strong></td>
        </tr>
        <tr>
          <td height="180" valign="top" bgcolor="#6E6E6E" align="left" style="padding:0px 15px 0px 15px"><?php echo $photo['description'];?></td>
        </tr>
      </table>
      <br />
      <table width="96%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="24" align="left" bgcolor="#a8a8a8">　<span class="STYLE5">访客留言</span></td>
          <td width="150" align="center" bgcolor="#a8a8a8"><span class="STYLE5">共有评论数 <span class="STYLE2"><?php echo $commentCount['amount'];?></span>条</span></td>
        </tr>
      </table>
	  <?php foreach($commentList as $array){ ?>
      <table width="96%" border="0" cellpadding="0" cellspacing="0" bgcolor="#b0b0b0">
        <tr>
          <td height="70" align="center" valign="middle"><table width="96%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50" align="left" valign="top">
			  <?php 
			  if($array['ifhide']==0){ 
				  echo $array['content'];
			  }else{
				  echo "<font color='#dedede'>以下评论被系统屏蔽</font>";			  
			  }
			  ?></td>
            </tr>
          </table></td>
          <td width="200" align="center" valign="top" class="timestamp"><?php echo $array['createtime'];?></td>
        </tr>
      </table>
      <table width="96%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="middle" bgcolor="#B0B0B0"><img src="img/photo_line.jpg" width="677" height="1" /></td>
        </tr>
      </table>
	  <?php } ?>
	  <table width="96%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td align="center" class="page"><?php echo $commentPage;?></td>
		</tr>
	  </table>
	  <form action="comment.php" method="post" >
      <table width="96%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="260" align="center" valign="middle" bgcolor="#B0B0B0"><textarea name="content" cols="60" rows="10" id="content" onClick="resetContent();">我来评两句... ...</textarea>
          <br />
          <br />
		  <input type="hidden" name="id" id="id" value="<?php echo $id;?>">
		  <input type="hidden" name="page" id="page" value="<?php echo $page;?>">
		  <input type="hidden" name="pageSize" id="pageSize" value="<?php echo $pageSize;?>">
          <input type="submit" name="button" id="button" value="提交"  class="Btn BtnNml" />　
          <input type="reset" name="button2" id="button2" value="重写"  class="Btn BtnNml"/></td>
        </tr>
      </table>
	  </form>
	  </td>
  </tr>
</table>
<br/>
<script language="javascript">
function resetContent(){
	if($("#content").val()=="我来评两句... ..."){
		$("#content").val("");
	}
}
function vote(id){
	$.ajax({
		type:"GET",
		cache:false,
		url:"vote.php?id="+id,
		success:function(ret){
			if(ret=="success"){
				alert("投票成功");
				refreshVote(id);
			}else{
				alert(ret);
			}
		}
	});
}
function refreshVote(id){
	$.ajax({
		type:"GET",
		cache:false,
		url:"photo.php?job=getnum&id="+id,
		success:function(ret){
			$("#votenum").html(ret);
		}
	});
}
</script>
<?php include template("footer"); ?>